<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ include file='../share_header.jsp' %>
<var id="tabId" style="display: none">${tabId}</var>
<var id="customerInfo" style="display: none">${customerInfo}</var>
<var id="trackRecords" style="display: none">${trackRecords}</var>

<div id="content-header">
    <h1>客户详细信息</h1>
</div>

<%--<div id="breadcrumb">--%>
<%--&lt;%&ndash;<a href="index.html" class="tip-bottom" data-original-title="Go to Home"><i class="icon-home"></i> Home</a>&ndash;%&gt;--%>
<%--<a href="javascript:void(0)"--%>
<%--url="${pageContext.request.contextPath}/crm/getMyselfClientInfo.do"  class="m-pageChange tip-bottom">客户信息管理</a>--%>
<%--<a href="javascript:void(0)"--%>
<%--url="${pageContext.request.contextPath}/crm/getMyselfClientInfo.do"  class="m-pageChange tip-bottom">我的客户</a>--%>
<%--<a href="#" class="current">查看记录</a>--%>
<%--</div>--%>

<div class="widget-box paddingLeft20 marginTop20">
    <div class="widget-title">
        <ul class="nav nav-tabs">
            <li class=""><a data-toggle="tab" href="#tab1">基本信息</a></li>
            <li class=""><a data-toggle="tab" href="#tab2">联系记录</a></li>
            <li class=""><a data-toggle="tab" href="#tab3">交易数据查询</a></li>
        </ul>
    </div>
    <div class="widget-content tab-content paddingRight10">
        <div id="tab1" class="tab-pane">
            <%@ include file='share_edit_add_customer.jsp' %>
            </fieldset>
            </form>
        </div>
        <div id="tab2" class="tab-pane">
            <table id="contectRecordInfoTable"></table>
            <button id="addRecordBtn" type="button" class="btn btn-primary" style="margin-left: 10px">新增</button>
        </div>
        <div id="tab3" class="tab-pane">
            <p>

            <h3>未确定（数据）</h3></p>
            <%--<table>--%>
            <%--<tr>--%>
            <%--<th>采购合同</th>--%>
            <%--<th>销售合同</th>--%>
            <%--<th>销售提单</th>--%>
            <%--<th>采购提单</th>--%>
            <%--<th>下次回访时间</th>--%>
            <%--<th>积分</th>--%>
            <%--<th>卖方评价</th>--%>
            <%--<th>买方评价</th>--%>
            <%--</tr>--%>
            <%--</table>--%>
            <%--<button id="exportBtn" type="button" class="btn btn-primary" style="margin-left: 10px">导出</button>--%>
        </div>
    </div>
</div>
<!-- Modal -->
<div id="addContactRecordModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
     aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3>新增联系记录</h3>
    </div>
    <div class="modal-body">
        <div>
            <form class="form-horizontal" action="javascript:return;" id="addRecordForm">
                <div class="control-group">

                    <!-- Select Basic -->
                    <label class="control-label">记录类型</label>

                    <div class="controls">
                        <select class="input-xlarge">
                            <option>业务咨询</option>
                        </select>
                    </div>

                </div>

                <div class="control-group">

                    <label class="control-label">记录内容</label>

                    <div class="controls">
                        <div class="textarea">
                            <textarea type="" class="" style="width:270px;height:70px;"> </textarea>
                        </div>
                    </div>
                </div>

                <div class="control-group">

                    <label class="control-label">下次回访时间</label>

                    <div class="controls">
                        <input type="text" placeholder="" class="input-xlarge">

                        <p class="help-block"></p>
                    </div>
                </div>

                <div class="control-group">

                    <label class="control-label">回访类型</label>

                    <div class="controls">
                        <select class="input-xlarge">
                            <option>回访电话</option>
                        </select>
                    </div>

                </div>

                <div class="control-group">

                    <label class="control-label">备注</label>

                    <div class="controls">
                        <div class="textarea">
                            <textarea type="" class="" style="height:70px;width:270px"> </textarea>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="modal-footer">
        <button id="addContactRecordBtn" type="button" class="btn btn-primary">提交</button>
        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button>
    </div>
</div>

<script src="${pageContext.request.contextPath}/resources/js/customer/viewRecords.js"></script>
<script>
    $(function () {
        //load tab 1 data
        gotoPage(1);
        var index = $("#tabId").text();
        //load tab 0 data
        var customerInfo = $("#customerInfo").text();
        var jsonData = $.parseJSON(customerInfo);
        loadData(jsonData.list[0]);

        //init tab
        $($(".nav-tabs a")[index]).click();

        //增加记录按钮
        $("#addRecordBtn").click(function () {
            $('#addContactRecordModal').modal('show');
        });

        //增加记录保存
        $("#addContactRecordBtn").click(function () {
            var url = "";
            var postData = $("#addRecordForm").serialize();
            postAjax(url, postData, saveSuccess);
        });
        var saveSuccess = function () {
            $('#addContactRecordModal').modal('hide');
            gotoPage(100000);
        };

    });
</script>



